Skip to content

Instantly share code, notes, and snippets.

@MartijnHols
MartijnHols / useDocumentHeight.ts
Last active May 11, 2024 10:19
React hooks for getting the document height that updates when the On Screen Keyboard/Virtual Keyboard toggles
The latest version is available at https://martijnhols.nl/gists/how-to-get-document-height-ios-safari-osk
@Pulimet
Pulimet / AdbCommands
Last active May 11, 2024 10:19
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@matthew01lokiet
matthew01lokiet / Pipfile
Last active May 11, 2024 10:19
ChatGPT Simple Client
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
openai = "~=1.0"
click = "~=8.0"
rich = "~=13.0"
@thibaut-decherit
thibaut-decherit / symfony-logout-csrf-protection.md
Last active May 11, 2024 10:15
Symfony - Logout with CSRF protection

URL version (GET)

config/packages/security.yaml

security:
  firewalls:
    main:
      logout:
        path: logout
        csrf_parameter: token
 csrf_token_generator: security.csrf.token_manager
@thibaut-decherit
thibaut-decherit / form-button.md
Last active May 11, 2024 10:15
Symfony Form Button

Form Button

Useful to send data to the server without relying on the user clicking on a link, which would send a GET request, which should not be used for destructive operations (operations with database writing).

For reference, see https://softwareengineering.stackexchange.com/questions/188860/why-shouldnt-a-get-request-change-data-on-the-server and https://stackoverflow.com/questions/46585/when-do-you-use-post-and-when-do-you-use-get

You could use it for a like button, a confirm button, a delete button...

Button with data passed

You need to activate an account. You send a link containing an activation token to the user. You could stop there and just activate the account once a GET request is sent to this url.

@earthdiver
earthdiver / taskbar.ps1
Last active May 11, 2024 10:15
A code snippet to put a resident PowerShell script into the taskbar notification area
#@Powershell -NoP -W Hidden -C "$PSCP='%~f0';$PSSR='%~dp0'.TrimEnd('\');&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & exit/b
# by earthdiver1 V1.05
if ($PSCommandPath) {
$PSCP = $PSCommandPath
$PSSR = $PSScriptRoot
$code = '[DllImport("user32.dll")]public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);'
$type = Add-Type -MemberDefinition $code -Name Win32ShowWindowAsync -PassThru
[void]$type::ShowWindowAsync((Get-Process -PID $PID).MainWindowHandle,0)
}
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
@GentlemanRevvnar
GentlemanRevvnar / 1.19-custom_structures_with_jigsaws.md
Last active May 11, 2024 10:11
Simple guide for using jigsaws in custom structures in 1.19

Custom data pack structures with jigsaws in 1.19

(Last updated: 1.19)

This is a direct conversion for 1.19, of my original guide for 1.18.2.
For the sake of continuity i will show everything from groundup again. I would show the new 1.19 sections in different colour, but github doesn't allow that 😐

This is technically a shameless rip/edit of Misode's guide (go give that beautiful man a heart under his guides) that shows the traditional use of newly implemented custom structure system. I myself want to tackle the jigsaw aspect a bit, hence i'm making my own guice based on his. I will show how to create a data pack that adds custom structures to the world that also utilize jigsaw blocks. So treat this as a basic jigsaw guide in world generation. There is a download for the datapack at the end of this guide.

**Always leave the world and rejoin to apply the new changes! Because traditional /reload or `/datapack disable & enabl

@FreddieOliveira
FreddieOliveira / docker.md
Last active May 11, 2024 10:10
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android πŸ‹πŸ“±

Edit πŸŽ‰

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@Meshiest
Meshiest / godot multiplayer.md
Last active May 11, 2024 10:08
overview of how I understand godot multiplayer

Godot 4 Scene Multiplayer

I'm too lazy to write this as official documentation so I'm transcribing my experiences here for reference.

This is high level and does not cover how to setup your peer, only how to use the API itself.

This is not a tutorial.

If you are just getting started, this tutorial by DevLogLogan is worth watching.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 11, 2024 10:07
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.